package com.jake.rabbitbootdemo.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {

    @Bean
    public Queue fanoutQueue1() {
        return new Queue("jake.fanout.queue.1");
    }

    @Bean
    public Queue fanoutQueue2() {
        return new Queue("jake.fanout.queue.2");
    }

    @Bean
    public Queue fanoutQueue3() {
        return new Queue("jake.fanout.queue.3");
    }

    @Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("jake.fanout.exchange");
    }

    @Bean
    public Binding bindFanoutQueue1() {
        return BindingBuilder.bind(fanoutQueue1()).to(fanoutExchange());
    }

    @Bean
    public Binding bindFanoutQueue2() {
        return BindingBuilder.bind(fanoutQueue2()).to(fanoutExchange());
    }

    @Bean
    public Binding bindFanoutQueue3() {
        return BindingBuilder.bind(fanoutQueue3()).to(fanoutExchange());
    }

}
